package com.htgd.gardenexpo.service.impl;

import com.htgd.gardenexpo.entity.GeConScienceUpload;
import com.htgd.gardenexpo.dao.GeConScienceUploadDao;
import com.htgd.gardenexpo.service.GeConScienceUploadService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (GeConScienceUpload)表服务实现类
 *
 * @author makejava
 * @since 2021-06-09 16:41:34
 */
@Service("geConScienceUploadService")
public class GeConScienceUploadServiceImpl implements GeConScienceUploadService {
    @Resource
    private GeConScienceUploadDao geConScienceUploadDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public GeConScienceUpload queryById(Integer id) {
        return this.geConScienceUploadDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<GeConScienceUpload> queryAllByLimit(int offset, int limit) {
        return this.geConScienceUploadDao.queryAllByLimit(offset, limit);
    }
    @Override
    public List<GeConScienceUpload> queryByScienceId(int id) {
        return this.geConScienceUploadDao.queryByScienceId(id);
    }

    /**
     * 新增数据
     *
     * @param geConScienceUpload 实例对象
     * @return 实例对象
     */
    @Override
    public GeConScienceUpload insert(GeConScienceUpload geConScienceUpload) {
        this.geConScienceUploadDao.insert(geConScienceUpload);
        return geConScienceUpload;
    }

    /**
     * 修改数据
     *
     * @param geConScienceUpload 实例对象
     * @return 实例对象
     */
    @Override
    public GeConScienceUpload update(GeConScienceUpload geConScienceUpload) {
        this.geConScienceUploadDao.update(geConScienceUpload);
        return this.queryById(geConScienceUpload.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.geConScienceUploadDao.deleteById(id) > 0;
    }
   @Override
    public boolean deleteByScienceId(Integer id) {
        return this.geConScienceUploadDao.deleteByScienceId(id) > 0;
    }

    @Override
    public boolean deleteByIds(String[] id,int sid) {
        return this.geConScienceUploadDao.deleteByIds(id,sid) > 0;
    }
}
